import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid) {
    const data = {
        username,
        password,
        code,
        uuid
    }
    return request({
        url: '/app-api/member/auth/login',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function smsLogin(data) {
    return request({
        url: '/smsLogin',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function forgetPassword(data) {
    return request({
        url: '/personal/forget-password',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 个人用户注册
export function register(data) {
    return request({
        url: '/app-api/member/auth/register',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 注册方法(经销商)
export function companyRegister(data) {
    return request({
        url: '/companyRegister',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取手机验证码(注册)
export function getPhoneCode(data) {
    return request({
        url: '/app-api/member/auth/send-sms-code',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取手机验证码(找回密码)
export function getCode(phoneNumber) {
    return request({
        url: '/personal/forget-password-code?phoneNumber='+phoneNumber,
        headers: {
            isToken: false
        },
        method: 'post',
    })
}

// 获取短信验证码(登录)
export function getSmsCode(data) {
    return request({
        url: '/getSmsCode',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取用户详细信息
export function getInfo() {
    return request({
        url: '/app-api/member/auth/get-permission-info-ry',
        method: 'get'
    })
}

// 退出方法
export function logout() {
    return request({
        url: '/app-api/member/auth/logout',
        method: 'post'
    })
}

// 记录项目
export function record(data) {
    return request({
        url: '/personal/record',
        method: 'post',
        data: data
    })
}

// 获取验证码
export function getCodeImg() {
    return request({
        url: '/captchaImage',
        headers: {
            isToken: false
        },
        method: 'get',
        timeout: 20000
    })
}
